home *** CD-ROM | disk | FTP | other *** search
/ Amiga Plus Special 23 / AMIGAplus Sonderheft 23 (2000)(Falke)(DE)[!].iso / Tools / Text-Viewer / MSWordView / mswordview_src / references.c < prev    next >
Encoding:
C/C++ Source or Header  |  1999-11-06  |  3.7 KB  |  119 lines

  1.  
  2. #include <stdio.h>
  3. #include "config.h"
  4. #include "mswordview.h"
  5. #include "roman.h"
  6.  
  7. extern FILE *erroroutput;
  8. extern FILE *outputfile;
  9. extern long int cp;
  10. extern int insuper;
  11. extern int footnotehack;
  12.  
  13.  
  14. void decode_f_reference(textportions *portions)
  15.     {
  16.     int i;
  17.     error(erroroutput,"footnotes\n");
  18.     /*
  19.     search in the first thing for the cp of this
  20.     reference, then use this index into the second
  21.     one to determine what text to use ?
  22.     */
  23.     i=0;
  24.     while(i<portions->fndref_no)
  25.         {
  26.         if (portions->fndRef[i] == cp)
  27.             {
  28.             error(erroroutput,"found correct ref pos at %x, index was %d\n",portions->fndRef[i],i);
  29.             if (portions->fndFRD[i] > 0)
  30.                 {
  31.                 if (!insuper)
  32.                     {
  33.                     fprintf(outputfile,"<sup>");
  34.                     insuper=2;
  35.                     }
  36.                 error(erroroutput,"is autonumbered <%d>\n",portions->fndFRD[i]);
  37.                 portions->fndTrueFRD[i] = portions->auto_foot++;
  38.                 fprintf(outputfile,"<a href=\"#foot%d\">%d</a>",i,portions->fndFRD[i]);
  39.                 }
  40.             else
  41.                 {
  42.                 error(erroroutput,"is custom <%d>\n",portions->fndFRD[i]);
  43.                 /*dont handling custom footnotes the same way*/
  44.                 fprintf(outputfile,"<a href=\"#foot%d\">",i);
  45.                 footnotehack=1;
  46.                 }
  47.             if (insuper==2)
  48.                 fprintf(outputfile,"</sup>");
  49.             break;
  50.             }
  51.         error(erroroutput,"conpared given pos %x and ref list %x",cp,portions->fndRef[i]);
  52.         i++;
  53.         }
  54.  
  55.     /*
  56.     now to hold off to the end of the page, before listing the references
  57.     off
  58.     */
  59.     if ( (i < portions->fndref_no ) && (i < 256) )
  60.         portions->list_footnotes[portions->list_foot_no++] = i;
  61.     else if (i >= 256)
  62.         fprintf(erroroutput,"oops silly programmer :-) lost a footnote\n");
  63.     }
  64.  
  65.  
  66. void decode_e_reference(textportions *portions)
  67.     {
  68.     int i;
  69.     char roman[81];
  70.     error(erroroutput,"endnotes\n");
  71.     /*
  72.     search in the first thing for the cp of this
  73.     reference, then use this index into the second
  74.     one to determine what text to use ?
  75.     */
  76.     i=0;
  77.     while(i<portions->endref_no)
  78.         {
  79.         if (portions->endRef[i] == cp)
  80.             {
  81.             error(erroroutput,"found correct ref pos at %x, index was %d\n",portions->endRef[i],i);
  82.             if (portions->endFRD[i] > 0)
  83.                 {
  84.                 if (!insuper)
  85.                     {
  86.                     fprintf(outputfile,"<sup>");
  87.                     insuper=2;
  88.                     }
  89.                 error(stderr,"is autonumbered <%d>, i is %d, true is %d\n",portions->endFRD[i],i,portions->endTrueFRD[i]);
  90.                 portions->endTrueFRD[i] = portions->auto_end++;
  91.                 fprintf(outputfile,"<a href=\"#end%d\">%s</a>",i,ms_strlower(decimalToRoman(portions->endTrueFRD[i],roman)));
  92.                 }
  93.             else
  94.                 {
  95.                 error(erroroutput,"is custom <%d>\n",portions->endFRD[i]);
  96.                 /*dont handling custom footnotes the same way*/
  97.                 fprintf(outputfile,"<a href=\"#end%d\">",i);
  98.                 footnotehack=1;
  99.                 }
  100.             if (insuper==2)
  101.                 fprintf(outputfile,"</sup>");
  102.             break;
  103.             }
  104.         error(erroroutput,"conpared given pos %x and ref list %x",cp,portions->endRef[i]);
  105.         i++;
  106.         }
  107.  
  108.     /*
  109.     now to hold off to the end of the page, before listing the references
  110.     off
  111.     */
  112.     if ( (i < portions->endref_no ) && (i < 256) )
  113.         portions->list_endnotes[portions->list_end_no++] = i;
  114.     else if (i >= 256)
  115.         fprintf(erroroutput,"oops silly programmer :-) lost a endnote\n");
  116.     }
  117.  
  118.  
  119.